package com.jellyfishumbrella.GL;

import java.util.LinkedHashSet;

public abstract class AbstractLOD extends AbstractOctreeFiller{
	public int		LOD			= -1;
	public int		nextLOD		= -1;
	public int		maxLOD		= 0;
	public boolean	resetLOD	= false;

	public LinkedHashSet<AbstractLOD> preSetLOD(int newLOD) {
		nextLOD = newLOD;
		return null;
	}
	
	public void updateLOD(){
		
	}

	public int setLOD(int newLOD) {
		if (newLOD > 0 && newLOD < maxLOD && newLOD != LOD) {
			LOD = newLOD;
		}
		return LOD;
	}

	public int incLOD() {
		if (LOD < maxLOD) {
			LOD++;
		}
		return LOD;
	}

	public int decLOD() {
		if (LOD > 0) {
			LOD--;
		}
		return LOD;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + LOD;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AbstractLOD other = (AbstractLOD) obj;
		if (LOD != other.LOD)
			return false;
		return true;
	}
}
